# ==== pipeline_registers.py ====
class IF_ID:
    def __init__(self):
        self.instruction = 0
        self.PC = 0
        self.valid = False

class ID_EX:
    def __init__(self):
        self.control_signals = None
        self.PC = 0
        self.read_data1 = 0
        self.read_data2 = 0
        self.imm = 0
        self.rt = 0
        self.rd = 0
        self.rs = 0
        self.funct = 0
        self.write_reg = 0  # 目标寄存器
        self.instr = 0      # 原始指令
        self.valid = False

class EX_MEM:
    def __init__(self):
        self.control_signals = None
        self.ALU_result = 0
        self.write_data = 0
        self.write_reg = 0
        self.zero = False
        self.instr = 0      # 原始指令
        self.valid = False

class MEM_WB:
    def __init__(self):
        self.control_signals = None
        self.ALU_result = 0
        self.mem_read_data = 0
        self.write_reg = 0
        self.instr = 0      # 原始指令
        self.valid = False